﻿@model List<Menu>
<nav>   
    <ul class="mainav" id="menu">
        @foreach (var item in Model)
        {
            <li class="@(item.ChildMenus.Any()?"downav":"")">             
               
                <a href="@item.Url" class="@(item.Url.Equals(Request.RawUrl)?"active":"")">
                    @item.Title
                    @if (item.ChildMenus.Any())
                    {
                        <i class="iconfont icon-down"></i>
                    }
                </a>             
                
                @if (item.ChildMenus.Any())
                {
                    <ul class="subNav">
                        @foreach (var subItem in item.ChildMenus)
                        {
                            <li>
                                @if (subItem.Url.Equals(Request.RawUrl))
                                {
                                    <a href="@subItem.Url" class="active">@subItem.Title</a>
                                }
                                else
                                {
                                    <a href="@subItem.Url">@subItem.Title</a>
                                }
                            </li>
                        }
                    </ul>
                }
            </li>
        }
    </ul>
</nav>